#include "widget.h"
#include "myhread.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    UiTh = new myhread(this);

}

Widget::~Widget()
{
    delete ui;
}

void Widget::updateUi(QString data)
{
    ui->lineEdit->setText(data);
}

void Widget::on_startBtn_clicked()
{
    pthread_mutex_lock(&UiTh->condMutex);
    pthread_cond_signal(&UiTh->mCond);
    pthread_mutex_unlock(&UiTh->condMutex);


//    pthread_mutex_lock(&UiTh->condMutex);
//    pthread_cond_wait(&UiTh->mCond,&UiTh->condMutex);
//    pthread_mutex_unlock(&UiTh->condMutex);
    UiTh->start();
}

void Widget::on_stopBtn_clicked()
{
    UiTh->stop();

}



void Widget::on_unLockBtn_clicked()
{

}
